

class X_Property:
    class_name ="X_Property"
    def __init__(self,x = 0):
        self.x = x
    
    def class_info(self):
        print('类变量值:',X_Property.class_name)
        print('实例变量值:',self.x)

    def chng(self,x):
        self.x = x
    def chng_cn(self,name):
        X_Property.class_name = name

aaa = X_Property()
bbb= X_Property()
print('初始化两个实例')
aaa.class_info()
bbb.class_info()
print('修改实例变量')
print('修改aaa实例变量')
aaa.chng(3)
aaa.class_info()
bbb.class_info()
print('修改bbb实例变量')
bbb.chng(10)
aaa.class_info()
bbb.class_info()
print('修改类变量')
print('修改aaa类变量')
aaa.chng('aaaa')
aaa.class_info()
bbb.class_info()
print(type(aaa.x)) #打印aaa.x的类型
print(type(bbb.x)) #打印bbb.x的类型

print('修改bbb类变量')
bbb.chng('bbbb')
aaa.class_info()
bbb.class_info()